package cn.dai.util;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * @author ArkD42
 * @file Jdbc
 * @create 2020 - 05 - 29 - 11:15
 */
public class C3p0Utils {

    // 池对象只需要一个即可
    private static final ComboPooledDataSource comboPooledDataSource = new ComboPooledDataSource("dev");

    // 获取连接对象，从池对象获取的对象可允许多个
    public static Connection getConnection(){
        try {
            return comboPooledDataSource.getConnection();
        } catch (SQLException sqlException) {
            sqlException.printStackTrace();
        }
        return null;
    }


}
